<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Worker</title>
        <style></style>
    </head>
    <body>
        <div>
            momo: <input class="momo" type="text" />
            <input class="kaka" type="text" />
        </div>
    </body>
    <script>
        window.onload = () => {
            let momo = document.querySelector(".momo");
            let kaka = document.querySelector(".kaka");

            let myWorker = new Worker("./a.js");

            // myWorker.addEventListener('message', )

            momo.addEventListener("input", function (event) {
                console.log("Message posted to worker", event);
                myWorker.postMessage([event.target.value]);
            });
        };
    </script>
</html>
